package senders;

import com.rabbitmq.client.Connection;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ExchangeSender extends Sender{

    public ExchangeSender(Connection connection, String queueName, boolean persistence, String exchangeName, String exchangeType, String routingKey) throws IOException {
        super(connection, queueName, persistence, exchangeName, exchangeType, routingKey);
    }

    @Override
    public void send(String s) throws IOException, TimeoutException {
        channel.exchangeDeclare(exchangeName, exchangeType);
        channel.basicPublish(exchangeName, routingKey,null,s.getBytes());
    }
}
